//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    phoneNumber: "13517400938",
    inputPassword: "12345678",
  },
  //获取用户输入的用户名
  phoneNumberInput:function(e)
  {
    this.setData({
      phoneNumber: e.detail.value
    })
  },
  passwordInput:function(e)
  {
    this.setData({
      inputPassword: e.detail.value
    })
  },
  //获取用户输入的密码
  //
  bindLoginTap: function () {
    wx.request({
      url: app.globalData.requestUrlPrefix + 'LogHandlerService.ashx?method=Verification_User_Log',
      data: {
        phoneNumber: this.data.phoneNumber,
        inputPassword: this.data.inputPassword,
      },
      header: {
        "content-type": app.globalData.contentTypeStr
      },
      method: "POST",
      success: res => {
        app.globalData.sessionKeyStr = res.header["Set-Cookie"].split(";")[0];

        if(1 == res.data.MessageType) {
          wx.navigateTo({
            url: '../index/index'
          })
        }
      }
    })
  },
})
